package com.mejlisse.gwt.scaffold;

import com.google.gwt.app.place.ProxyListPlace;
import com.google.gwt.text.shared.AbstractRenderer;
import com.mejlisse.gwt.request.ApplicationEntityTypesProcessor;
import com.mejlisse.gwt.request.NewsRecord;
import com.mejlisse.gwt.request.CommentRecord;

/**
 * Renders {@link ProxyListPlace}s for display to users.
 */
//TODO i18n
public class ApplicationListPlaceRenderer extends AbstractRenderer<ProxyListPlace> {

	public String render(ProxyListPlace object) {
		return new ApplicationEntityTypesProcessor<String>() {

			@Override
			public void handleNews(NewsRecord isNull) {
				setResult("Newss");
			}
			@Override
			public void handleComment(CommentRecord isNull) {
				setResult("Comments");
			}
		}.process(object.getProxyClass());
	}
}
